Skip to content

[AAASM-3020] ♻️ (types): Adopt PEP 695 typing standard#131

Merged
Chisanan232 merged 4 commits into
masterfrom
v0.0.1/AAASM-3020/refactor/pep695_typing
Jun 16, 2026
Merged

[AAASM-3020] ♻️ (types): Adopt PEP 695 typing standard#131
Chisanan232 merged 4 commits into
masterfrom
v0.0.1/AAASM-3020/refactor/pep695_typing

Conversation

@Chisanan232

Copy link
Copy Markdown
Contributor

Summary

Adopts PEP 695 as the python-sdk typing standard (Python ≥ 3.12). Implements AAASM-3020.

  • pyproject.toml — bump the mypy floor >=1.2.0>=1.11 (PEP 695 support landed in mypy 1.11; installed toolchain is already 1.17).
  • agent_assembly/types.py — convert CallStackNodeKind = Literal[...] to the PEP 695 type statement (type CallStackNodeKind = Literal[...]). The module docstring already claimed aliases use the type statement — the code now matches it. Annotation-only, lazily evaluated; no runtime/behaviour change.
  • CONTRIBUTING.md — new "Type annotations (PEP 695)" section: prefer type X = … aliases and class C[T]/def f[T] generics.

There are 0 existing TypeVar/Generic usages, so this is forward-convention + the type-alias win — no generic retrofit.

Type of Change

  • ♻️ Refactoring (typing-only) + 📝 docs + ⬆️ dep floor

Breaking Changes

  • No (annotations only; CallStackNodeKind stays a Literal alias, public API unchanged)

Testing

  • Full suite: 443 passed / 9 skipped — identical to master (zero behaviour change).
  • mypy agent_assembly/types.pySuccess: no issues found (the converted file is type-clean).

Dependency note (read before merge)

This PR is conflict-free with the open PR #130 (AAASM-3017, mypy debt) — the only shared file is types.py, and the edits are on non-overlapping lines (this PR: line 24; #130: line 110), so git auto-merges regardless of order.

A full repo-wide mypy agent_assembly currently reports 34 errors — all pre-existing in other files (emitter.py, __init__.py, models/agent.py), which #130 fixes. This PR adds 0 new mypy errors (verified: 34 baseline → 34; types.py itself is clean). Once #130 merges, the repo-wide mypy goes to 0. Merge order between this and #130 does not matter.

Closes AAASM-3020.

Chisanan232 and others added 4 commits June 16, 2026 08:09
PEP 695 (the `type` statement + type-parameter syntax) is supported
from mypy 1.11; bump the floor so the typing standard is enforced.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The module docstring already states aliases use the PEP 695 `type`
statement, but the code used legacy assignment. Convert it so the code
matches the documented standard. Annotation-only; no behaviour change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a Type annotations (PEP 695) section: prefer the `type` alias
statement and `class C[T]`/`def f[T]` generics, requiring mypy >= 1.11.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Chisanan232

Copy link
Copy Markdown
Contributor Author

🤖 Claude Code — PR review

Ticket: AAASM-3020 — Adopt PEP 695 as the python-sdk typing standard.

CI — ✅ all green

CI Success ✅ · unit/integration test runs (3.13) ✅ · SonarCloud ✅ · codecov/patch ✅ · build-native-core ✅ · Verify PEP 561 ✅ · Test Type Imports ✅ · Analyze (python) ✅ · docs build ✅. (Unlike the larger #130, the coverage gates pass here — this is a 4-line-ish change.) Nothing to fix.

Scope vs. acceptance criteria — ✅ complete

AC Status Evidence
mypy floor >=1.11 pyproject.toml + uv.lock (3 dep groups) bumped >=1.2.0>=1.11
PEP 695 type alias defined + demonstrated type CallStackNodeKind = Literal[...] in types.py — also fixes a real mismatch: the module docstring already claimed PEP 695 type-statement usage, but the code used legacy assignment
Convention documented in CONTRIBUTING new "Type annotations (PEP 695)" section (prefer type X = …, class C[T]/def f[T])
black/isort clean; tests unchanged (no behaviour change) full suite 443 passed / 9 skipped — identical to master; format hooks pass in CI; types.py is mypy-clean

4 granular commits (floor bump · type statement · CONTRIBUTING · uv.lock sync). 0 existing generics, so this is the complete PEP 695 foundation + the one real alias conversion — no generic retrofit needed.

Dependency note (non-blocking, merge order irrelevant)

Conflict-free with the open #130 (AAASM-3017). Only shared file is types.py, edited on non-overlapping lines (this PR line 24; #130 line 110) → git auto-merges either order. Repo-wide mypy agent_assembly still shows 34 errors — all pre-existing in other files (the debt #130 fixes); this PR adds 0 (verified 34→34; types.py itself is clean). Once #130 merges, repo-wide mypy = 0.

Readiness

Ready to merge pending one Pioneer-team approval. CI fully green, behaviour-neutral, all ACs met. Establishes the PEP 695 standard the codebase already documented but hadn't applied.

Recorded as a review note; no formal approval submitted.

@Chisanan232 Chisanan232 merged commit c12092d into master Jun 16, 2026
25 checks passed
@Chisanan232 Chisanan232 deleted the v0.0.1/AAASM-3020/refactor/pep695_typing branch June 16, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant